Python:lexical analysis